namespace LS.Digitize
{
    public static class WriterExtensions
    {
        public static WriteFileScope WriteFileScope(this IWriter writer)
        {
            return new WriteFileScope(writer);
        }

        public static WriteObjectScope WriteObjectScope(this IWriter writer)
        {
            return new WriteObjectScope(writer);
        }

        public static WritePropertyScope WritePropertyScope(this IWriter writer, string name)
        {
            return new WritePropertyScope(writer, name);
        }
        public static WriteCollectionScope WriteCollectionScope(this IWriter writer)
        {
            return new WriteCollectionScope(writer);
        }
        public static WriteCollectionItemScope WriteCollectionItemScope(this IWriter writer,int index)
        {
            return new WriteCollectionItemScope(writer, index);
        }
        public static WriteDictionaryScope WriteDictionaryScope(this IWriter writer)
        {
            return new WriteDictionaryScope(writer);
        }
        public static WriteDictionaryKeyScope WriteDictionaryKeyScope(this IWriter writer,int index)
        {
            return new WriteDictionaryKeyScope(writer, index);
        }
        public static WriteDictionaryValueScope WriteDictionaryValueScope(this IWriter writer,int index)
        {
            return new WriteDictionaryValueScope(writer, index);
        }

        public static bool SerializationDepthLimitExceeded(this IWriter writer, int deepLimit = 64)
        {
            return writer.Deepth > deepLimit;
        }
    }
}